<template>
  <div class="m-page m-page--boss">
    <van-nav-bar
      class="m-page__bar"
      title="成为董事"
      left-arrow
      @click-left="onClickLeft"
    />
    <!-- bannser -->
    <div class="m-page__banner"><img src="~_a/img/boss_stock.png" /></div>
    <!-- 内容 start -->
    <van-cell-group>
      <van-cell title="【抖贴-低周波理疗仪】董事补货" />
      <van-cell
        title-class="m-cell-title"
        :title="`￥${price}/套`"
        :label="`市场价￥${market_price}/套`"
      />
    </van-cell-group>
    <van-cell-group class="g-mt--10">
      <van-cell title-class="g-c--gray" title="请选择商品规格及数量" is-link />
    </van-cell-group>
    <article class="m-panel m-panel--detail g-mt--10">
      <header class="m-panel__header">图文详情</header>
      <div class="m-panel__content"><img src="~_a/img/details-img.jpg" /></div>
    </article>
    <!-- 内容 end -->
    <van-goods-action>
      <van-goods-action-mini-btn icon="wap-home" to="/" />
      <van-goods-action-big-btn primary text="立即开通" @click="showDialog" />
    </van-goods-action>
  </div>
</template>

<script>
import {
  NavBar,
  GoodsAction,
  GoodsActionBigBtn,
  GoodsActionMiniBtn,
  Cell,
  CellGroup
} from "vant";
import { goodsModel } from "@/api";
export default {
  name: "become_boss",
  data() {
    return {
      price: "",
      market_price: ""
    };
  },
  components: {
    "van-nav-bar": NavBar,
    "van-goods-action": GoodsAction,
    "van-goods-action-big-btn": GoodsActionBigBtn,
    "van-goods-action-mini-btn": GoodsActionMiniBtn,
    "van-cell": Cell,
    "van-cell-group": CellGroup
  },
  created() {
    this.getGoodsPrice();
  },
  methods: {
    /* 获取商品规格列表 */
    getGoodsPrice() {
      goodsModel._getGoodsPrice().then(res => {
        this.goodsPrice = res;
        this.price = this.goodsPrice.product_price;
        this.market_price = this.goodsPrice.origin_product_price;
      });
    },
    onClickLeft() {
      this.$router.go(-1);
    },
    showDialog() {
      this.$dialog.alert({
        title: "提示",
        message:
          "如需成为董事，请直接联系您的上级董事或致电官方客服，感谢您的支持！"
      });
    },
    beforeClose(action, done) {
      if (action === "confirm") {
        setTimeout(done, 1000);
      } else {
        done();
      }
    }
  }
};
</script>

<style scoped></style>
